package com.w.wx.controller;


import com.w.wx.domain.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpSession;


@Controller
public class Login {

	
	@RequestMapping("/loginvalidate")
	public String loginvalidate(@RequestParam("username") String username,@RequestParam("password") String pwd,HttpSession httpSession){


			return "chatroom";

	}

	@RequestMapping("/login")
	public String login(){
		return "chatroom";
	}



	
	@RequestMapping("/logout")
	public String logout(HttpSession httpSession){
		return "aa";
	}
	
	@RequestMapping(value="/currentuser",method = RequestMethod.GET)
	@ResponseBody
	public User currentuser(HttpSession httpSession){
		Long uid = (Long)httpSession.getAttribute("uid");
		String name ="Jon" ;
		return new User(uid, name);
	}
  }
